package com.faya.green.service.impl;

import com.faya.green.dao.user.RelationshipDao;
import com.faya.green.model.Relationship;
import com.faya.green.service.RelationshipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author ：LX
 * 创建时间： 2018/8/24. 22:18
 * 地点：广州
 * 目的: 关系表（对于主用户和隶属用户关系的关系表）
 * 备注说明：
 */
@Service
public class RelationshipServiceImpl implements RelationshipService {

    //压制全部警告
    @SuppressWarnings("all")
    @Autowired
    private RelationshipDao relationshipDao;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void updateRelationship(Relationship relationship) {
        relationshipDao.updateRelationship(relationship);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void addRelationship(Relationship relationship) {
        relationshipDao.addRelationship(relationship);
    }

    @Override
    public Relationship getRelationshipById(String id) {
        return relationshipDao.getRelationshipById(id);
    }

    @Override
    public List<Relationship> getRelationshipByFather(String father) {
        return relationshipDao.getRelationshipByFather(father);
    }

    @Override
    public Relationship getRelationshipBySonId(String sonId) {
        return relationshipDao.getRelationshipBySon(sonId);
    }
}
